/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
/* Copyright (C) 2012 Zongyou Yao. All rights reserved.     */

#include <stdio.h>

#define ASSERT_EQ(val_1, val_2) unittest(#val_1" == "#val_2,                   \
                                         (val_1) == (val_2), __FILE__, __LINE__)

#define ASSERT_TRUE(val)        unittest(#val, val, __FILE__, __LINE__)


void unittest(const char *test, int condition, const char *file, int line)
{
    if (condition) {
        printf("\e[1m\e[32m[  OK  ]\e[m [%s:%03d] %s\n", file, line, test);
    } else {
        printf("\e[1m\e[31m[FAILED]\e[m [%s:%03d] %s\n", file, line, test);
    }
}

/*
int main(int argc, char **argv)
{
    ASSERT_TRUE(1 == 2);
    ASSERT_TRUE(2 == 2);

    return 0;
}
*/
